package com.feihong.yw189.utils;

import com.feihong.yw189.model.User.UserEntity;

import java.util.HashMap;

/**
 * @author wangziheng
 * @name Android  美恰客服传参配置
 * @class name：com.feihong.yw189.utils
 * @class describe:
 * @time 2018/1/13 11:23
 * @change
 * @chang time
 * @class describe
 */
public class CustomServiceUtil {
    private HashMap<String, String> mConfigHashMap;

    public CustomServiceUtil() {

        mConfigHashMap = new HashMap<>();
    }

    public HashMap<String, String> queryConfig() {

        // 默认参数
        if (UserLoginInfo.getUserLoginInfoInstance().isUserLogin()) {
            mConfigHashMap.put("name", "Android_"+UserLoginInfo.getUserLoginInfoInstance().getUserId());
            UserEntity userEntity = UserLoginInfo.getUserLoginInfoInstance().getUserLoc();
           // mConfigHashMap.put("用户绑定手机号", user != null ? user.getUserPhone() : "");
            mConfigHashMap.put("用户名",  userEntity.getUserName());
            mConfigHashMap.put("agent_id",  userEntity.getUserAgentUserID());
            mConfigHashMap.put("上级代理商",userEntity.getUserAgentUserName());
            //mConfigHashMap.put("agent_tel", user != null ? user.getAgent_tel() : "");
            mConfigHashMap.put("用户类型", userEntity.getUserType());
            mConfigHashMap.put("用户地址", userEntity.getUsrAdr());
        }
        mConfigHashMap.put("source", "营维189");
        mConfigHashMap.put("客户端", "Android_" + android.os.Build.MODEL);
        mConfigHashMap.put("avatar", "https://s3.cn-north-1.amazonaws.com.cn/pics.meiqia.bucket/1dee88eabfbd7bd4");
        return mConfigHashMap;
    }

    /**
     * 客服   特殊需要
     * @param key
     * @param value
     */
    public void setParams(String[] key, String[] value) {
        int length = key.length;
        if (length != value.length) {
            throw new IndexOutOfBoundsException("key数组和value数组长度不一致");
        }
        for (int i = 0; i < length; i++) {
            mConfigHashMap.put(key[i], value[i]);
        }
    }
}
